
<%
	//Provide default variables for all session attributes used by this page.
	if (session.getAttribute("username") == null) {
		session.setAttribute("username", "");
	}
	if (session.getAttribute("email") == null) {
		session.setAttribute("email", "");
	}
	if (session.getAttribute("errors") == null) {
		session.setAttribute("errors", "");
	}

	// Retrieve necessary session attributes.
	String username = (String) session.getAttribute("username");
	String email = (String) session.getAttribute("email");
	String errors = (String) session.getAttribute("errors");

	// Clear all the attributes after they have been read.
	session.setAttribute("errors", null);
	session.setAttribute("username", null);
	session.setAttribute("email", null);
%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
<title>Scholar Aide</title>
<script language="javascript" type="text/javascript">
	function registerClicked() {
		javascript: register.submit();
	}
</script>
</head>
<body>
	<jsp:include page="/includes/header.jsp" />
	<div id="wrapper">
		<div id="content">
			<a href="login.jsp" class="right red_button">Go Back</a> <br /> <br />
			<form name="register" action="validate_register.jsp" method="post">
				<table class="center" id="login">
					<tr>
						<td>Username:</td>
						<td><input name="username" type="text" value="<%=username%>" /></td>
					</tr>
					<tr>
						<td>Password:</td>
						<td><input name="password" type="password" /></td>
					</tr>
					<tr>
						<td>Retype Password:</td>
						<td><input name="retype_password" type="password" /></td>
					</tr>
					<tr>
						<td>Email:</td>
						<td><input name="email" type="text" value="<%=email%>" /></td>
					</tr>
					<tr>
						<td></td>
						<td><a href="Javascript:void();" class="right red_button" onclick="registerClicked()">Register</a></td>
					</tr>
				</table>
				<input class="hidden" type="submit" />
				<div id="errors"><%=errors%></div>
			</form>
		</div>
	</div>
	<jsp:include page="/includes/footer.jsp" />
</body>
</html>